﻿{include file="public/header" /}
<style>
	.am-dropdown{
		width: 100%;
		margin-left: 30px;
		margin-bottom: 10px;
	}
	.am-dropdown div{
		color: #000;
	}
</style>
<form method="post" class="form-x" action="{if $data.id}?id={$data.id}{/if}">
	<div class="panel admin-panel" style="background: #fff; overflow: hidden">
		<br>
		<script>
            //city canshu
            var pid='{$data.pid}';
            var cid='{$data.cid}';
            var aid='{$data.aid}';
            var selectc=true;
            var selecta=true;
		</script>
		<div class="am-dropdown">
			<div class="label">
				<label>{:lang('currency')['city']}</label>
			</div>
			<div class="field">
				{include file="public/city" /}
			</div>
		</div>
		<div class="am-dropdown">
			<div class="label">
				<label>类型</label>
			</div>
			<div class="field">
				<select name="type" class="input input-auto" onchange="change(this.value)">
					<option value="0" {if $data.type == 0 || !$data.type}selected{/if}>上方轮播图</option>
					<option value="1" {if $data.type == 1}selected{/if}>下方轮播图</option>
					<option value="2" {if $data.type == 2}selected{/if}>广告图</option>
				</select>
			</div>
		</div>
		<div class="am-dropdown">
			<div class="label">
				<label for="title">{:lang('label')['title']}</label>
			</div>
			<div class="field">
				<input type="text" class="input input-auto" id="title" name="title" value="{$data.title}" size="80" placeholder="{:lang('label')['title']}" data-validate="required:{:lang('currency')['required']}" />
			</div>
		</div>
		<div class="am-dropdown">
			<div class="label">
				<label>参数</label>
			</div>
			<div class="field">
				<select name="url_type" id="url_type" class="input input-auto">
					<option value="网页" {if $data.url_type == '网页'}selected{/if}>网页</option>
					<option value="商家" {if $data.url_type == '商家'}selected{/if}>商家</option>
				</select>
				
				<input type="text" class="input input-auto" {if $data.url_type != '网页'}style="display:none"{/if} id="url" name="url" value="{$data.url}" size="80" placeholder="{:lang('label')['url']}" data-validate="required:{:lang('currency')['required']}" />
				<select class="input input-auto" {if $data.url_type != '商家'}style="display:none"{/if} id="url_seller" name="url_seller">
				{volist name="seller_list" id="seller"}
				<option {if $data.url == $seller.id}selected{/if} value="{$seller.id}">{$seller.name}</option>
				{/volist}
				</select>
			</div>
		</div>
		<div class="am-dropdown">
			<div class="input-inline clearfix">
				<div class="label">
					<label for="image">{:lang('label')['image']}</label>
				</div>
				<div class="field">
					<input type="text" readonly class="input input-auto" id="image" name="image" value="{$data.image}" size="65" placeholder="{:lang('label')['image']}" required/>
					<span class="addbtn"><button type="button" data-id="image" class="button upload">{:lang('form')['file']}</button></span>
				</div>
			</div>
		</div>
		<div class="am-dropdown" id="time_div" {if $data.type != 2}style="display:none"{/if}>
		<div class="label">
			<label for="url">显示时间</label>
		</div>
		<div class="field">
			<input type="number" class="input input-auto" id="time" name="time" value="{$data.time}" size="10" placeholder="显示时间" data-validate="required:{:lang('currency')['required']}" /> 秒
		</div>
	</div>
	<div class="am-dropdown">
		<div class="label">
			<label>{:lang('label')['status']}</label>
		</div>
		<div class="field">
			<div class="button-group button-group-small radio">
				<label class="button {if $data.status == "1" || !$data.status}active{/if}">
				<input name="status" value="1" {if $data.status == "1" || !$data.status}checked="checked"{/if} type="radio"><span class="icon icon-check"></span> {:lang('currency')['status_1']}</label>
				<label class="button {if $data.status == "2"}active{/if}">
				<input name="status" value="2" {if $data.status == "2"}checked="checked"{/if} type="radio"><span class="icon icon-times"></span> {:lang('currency')['status_2']}</label>
			</div>
		</div>
	</div>
	<div class="am-dropdown">
		<div class="label">
			<label>{:lang('label')['remark']}</label>
		</div>
		<div class="field">
			<textarea name="remark" class="input input-auto" rows="5" cols="80" placeholder="{:lang('label')['remark']}" data-validate="required:{:lang('currency')['required']}">{$data.remark}</textarea>
		</div>
	</div>
	<div class="form-button">
		<button class="button bg-main" type="submit">{:lang('form')['submit']}</button>
	</div>
	<br/>
	</div>
</form>
<script>
    var time_ = '{$data.time}';
    function change(val) {
        if(val != 2){
            $("#time").val(0);
            $("#time_div").css('display','none');
        }else{
            $("#time").val(time_);
            $("#time_div").css('display','');
        }
    }
	var url_type = "{$data.url_type}";
	$('#url_type').change(function(){
		if($(this).val() == "网页"){
			$("#url").show()
			if(url_type == "商家"){
				$("#url").val('')
			}
			$("#url_seller").hide()
		}else{
			$("#url").hide()
			$("#url_seller").show()
		}
	});
</script>
{include file="public/footer" /}